var app = new Vue({
    el: '#player',
    data: {
        query: '',
        musicList: [],
        musicUrl: '',
        hotComments: [],
        isPlaying: false,
        isShow: false,
        mvUrl: '',

    },
    methods: {
        searchMusic: function () {
            var that = this;
            axios.get('https://autumnfish.cn/search?keywords=' + this.query)
                .then(function (response) {

                    that.musicList = response.data.result.songs;
                    console.log(response.data.result.songs)
                }, function (err) {
                    console.log(err)
                })
        },
        playMusic: function (musicId) {
            // console.log(musicId)
            var that = this;
            axios.get('https://autumnfish.cn/song/url?id=' + musicId)
                .then(function (response) {
                    // console.log(response)
                    that.musicUrl = response.data.data[0].url;
                }, function (err) {
                })

            // 图片接口不通
            axios.get('https://autumnfish.cn/song/datail?ids=' + musicId)
                .then(function (response) {
                    // console.log(response)
                    // console.log("成功")
                }, function (err) {// console.log(err)
                    console.log('图片接口失败')
                })

            axios.get('https://autumnfish.cn/comment/hot?type=0&id=' + musicId)
                .then(function (response) {
                    console.log('评论')
                    // console.log(response.data.hotComments)
                    that.hotComments = response.data.hotComments;
                }, function (err) {
                })
        },
        play: function () {
            console.log("开始")
            this.isPlaying = true;
        },
        pause: function () {
            console.log("停止")
            this.isPlaying = false;
        },
        playMV: function (mvid) {
            var that = this;
            axios.get('https://autumnfish.cn/mv/url?id=' + mvid)
                .then(function (response) {
                    console.log(response)
                    // console.log(response.data.data.url)
                    that.isShow = true;
                    that.mvUrl = response.data.data.url;
                }, function (err) {

                })
        },
        hide: function () {
            this.isShow = false;
            this.mvUrl = "";
        }
    }
})